home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / PRGMMING / CPP100.ZIP / CPPLTXT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-22  |  7.5 KB  |  166 lines

  1. /*****************************************************************************/
  2. /*       (C) 1993,1994 R. NADE - M. GRANDCHAMP - All Rights Reserved         */
  3. /*****************************************************************************/
  4. /*    This source-code is NOT public domain nor Freeware, this is part of    */
  5. /*              'The C Programming Package' which is Shareware.              */
  6. /*   If you use this code, please register and get a free Full-VGA version   */
  7. /*****************************************************************************/
  8.                             /*---------------------*
  9.                              *       CPPLTXT.C     *
  10.                              *  Integrator Program *
  11.                              *   for managers and  *
  12.                              *   linked programs   *
  13.                              *---------------------*/
  14.  
  15.  /* Included Files */
  16.  # include <stdio.h>
  17.  # include <io.h>
  18.  # include <conio.h>
  19.  # include <dir.h>
  20.  # include <dos.h>
  21.  
  22.  /* Global Variables */
  23.  /* Variables in relation with config & menus */
  24.  int x1,y1,x1,x2,xms,xmsa,yms,ymsa,colour1,colour2,colour3,colour4,colour5;
  25.  int cardtype,divx,divy,printer,pagemaxi,videocard,nbdisk,hexa;
  26.  int menu0,menu1,menu2,menu3,menu4,menu5,menu6,menu7,menu8,menu9,menu10;
  27.  int colourchoice,return0,return1,return2,return3,chx2,recording;
  28.  unsigned int jouract,monthact,yearact,ref,nbref,nbrep;
  29.  unsigned char path[65],record[65],work[65],filedir[65],saverep[65];
  30.  struct ffblk ffblk;
  31.  struct dfree dfree;
  32.  struct directory{
  33.                 unsigned char name[9];
  34.                 unsigned char ext[4];
  35.         unsigned char size[9];
  36.                 unsigned char attribut[2];
  37.                 unsigned char date[9];
  38.                 unsigned char time[6];
  39.               } directory;
  40.  
  41.  /* Variables useable in all programs */
  42.  int bm,choice,i,j,k,l,m,line,lline,linemax,modif,n,t,x,xm,y,y1,y2,ym,z;
  43.  int returning,beginningfile,endfile;
  44.  int button,soundvar,intro,music,number,mode,modif;
  45.  int numact,chx,chif,background,colourprov;
  46.  int pfdiv,pfserv,pfhelp,pfic;
  47.  long dep,dephelp,depdiv,tbeginning,tend,tdiff,depbeginning,enddep,depfile;
  48.  unsigned long nbbytes;
  49.  unsigned char c0,c1,c2,nc1[11],nc2[11],letbis[2],screen2[640],divers[150];
  50.  unsigned char trashcan[81],trashhelp[9],trashelhelp[41],trashret[81];
  51.  unsigned char buff1[2],namefile[13],screen[4000],screenhelp[4000];
  52.  char *beginning,*theend,*memory,*diversity;
  53.  struct text_info ti;
  54.  struct text_info thelp;
  55.  
  56.  /*-------------------------*
  57.   * MESSAGE (error message) *
  58.   *   5 lines of 20 chars   *
  59.   *-------------------------*/
  60.   int message(lin1,lin2,lin3,lin4,lin5)
  61.     unsigned char lin1[20],lin2[20],lin3[20],lin4[20],lin5[20];
  62.     {
  63.       /* Draw a window with the message sent */
  64.       /* but first we save the screen !      */
  65.       save_screen2(48,13);
  66.       textattr(colour5);                 sound3();
  67.       gotoxy(48,13);                     cputs("                        ");
  68.       gotoxy(48,14);                    cputs(" ╔════════════════════╗ ");
  69.       gotoxy(48,15);                    cputs(" ║   M E S S A G E    ║ ");
  70.       gotoxy(48,16);                    cputs(" ╟────────────────────╢ ");
  71.       gotoxy(48,17);                    cputs(" ║                    ║ ");
  72.       gotoxy(48,18);                    cputs(" ║                    ║ ");
  73.       gotoxy(48,19);                    cputs(" ║                    ║ ");
  74.       gotoxy(48,20);                    cputs(" ║                    ║ ");
  75.       gotoxy(48,21);                    cputs(" ║                    ║ ");
  76.       gotoxy(48,22);                    cputs(" ╚════════════════════╝ ");
  77.       gotoxy(48,23);                    cputs("                        ");
  78.       gotoxy(51,17);                   cputs(lin1);
  79.       gotoxy(51,18);                   cputs(lin2);
  80.       gotoxy(51,19);                   cputs(lin3);
  81.       gotoxy(51,20);                   cputs(lin4);
  82.       gotoxy(51,21);                   cputs(lin5);
  83.       k=wait_for_a_key();         restore_screen2(48,13);
  84.       return(k);
  85.     }
  86.  /*-------------------------*
  87.   * WARNING (error message) *
  88.   * 5 lines of 20 chars     *
  89.   *-------------------------*/
  90.   void warning(lin1,lin2,lin3,lin4,lin5)
  91.     unsigned char lin1[20],lin2[20],lin3[20],lin4[20],lin5[20];
  92.     {
  93.       /* Draw a window with the message sent */
  94.       /* but first we save the screen !      */
  95.       save_screen2(8,9);
  96.       textattr(colour5);                 sound3();
  97.       gotoxy(8,9);                     cputs("                        ");
  98.       gotoxy(8,10);                    cputs(" ╔════════════════════╗ ");
  99.       gotoxy(8,11);                    cputs(" ║   ATTENTION ERROR  ║ ");
  100.       gotoxy(8,12);                    cputs(" ╟────────────────────╢ ");
  101.       gotoxy(8,13);                    cputs(" ║                    ║ ");
  102.       gotoxy(8,14);                    cputs(" ║                    ║ ");
  103.       gotoxy(8,15);                    cputs(" ║                    ║ ");
  104.       gotoxy(8,16);                    cputs(" ║                    ║ ");
  105.       gotoxy(8,17);                    cputs(" ║                    ║ ");
  106.       gotoxy(8,18);                    cputs(" ╚════════════════════╝ ");
  107.       gotoxy(8,19);                    cputs("                        ");
  108.       gotoxy(12,13);                   cputs(lin1);
  109.       gotoxy(12,14);                   cputs(lin2);
  110.       gotoxy(12,15);                   cputs(lin3);
  111.       gotoxy(12,16);                   cputs(lin4);
  112.       gotoxy(12,17);                   cputs(lin5);
  113.       wait_for_a_key();           restore_screen2(8,9);
  114.     }
  115.  /*--------------------------------------------------------------------------*
  116.   * MAIN LOOP *
  117.   *-----------*/
  118.   void main(argc,argv)
  119.     int argc;
  120.     char *argv[];
  121.     {
  122.       intro=1;                  music=1;
  123.       /* Did we give an argument ? */
  124.       if(argc>1){
  125.     strcpy(buff1,argv[1]);
  126.     /* If the argument was M or m we display only */
  127.         /* the introduction without playing music     */
  128.         if((buff1[0]==77)||(buff1[0]==109))   music=0;
  129.         /* If the argument was I or i we do not display the introduction */
  130.         /* and we do not play the music, not tested after                */
  131.     if((buff1[0]==73)||(buff1[0]==105))   intro=0;
  132.       }
  133.       i=program_init();
  134.       if(i==0){
  135.     system("mode 80");             return;
  136.       }
  137.       games_with_the_mouse();
  138.       /* Play the introduction and check the date to ensure */
  139.       /* that the program is not too old                    */
  140.       t=check_the_validity();
  141.       if(t<1){
  142.         /* The using date of this demo is over */
  143.         warning(" The using date"," of this demo"," is over. Please"," ask for an update"," Press a key or click");
  144.     system("mode 80");           return;
  145.       }
  146. intro=0;
  147.       if(intro==1){
  148.         display_opening_screen();
  149.         if(music==1)                 vivaldi_s_spring();
  150.     else                           c1=getch();
  151.       }
  152.       /* Hide the cursor, do not show the blinking cursor during pause */
  153.       _setcursortype(_NOCURSOR);
  154. /*      display_init_screen(); */
  155.       main_menu_manager();
  156.       /* show the cursor before going to DOS */
  157.       _setcursortype(_NORMALCURSOR);
  158.       /* If required, we go back to the good drive */
  159.       nc1[0]=path[0];                nc1[1]=path[1];
  160.       nc1[2]=0x00;                     system(nc1);
  161.       chdir(path);
  162.       /* Back to the standard screen mode */
  163.       system("mode 80");               return;
  164.     }
  165. /* End of main program */
  166.